package com.lambda.hybrid.handler;

import android.view.View;
import android.widget.FrameLayout;
import android.widget.ProgressBar;

import com.lambda.hybrid.Callback;
import com.lambda.hybrid.R;

public class HideHUDHandler extends AbstractHandler {
    private final FrameLayout mParentView;
    private ProgressBar mProgressBar;

    public HideHUDHandler(FrameLayout parent) {
        mParentView = parent;
    }

    @Override
    public void onHandle(String data, Callback callback) throws Exception {
        if (mProgressBar == null) {
            mProgressBar = mParentView.findViewById(R.id.hybrid_hud);
        }
        mProgressBar.setVisibility(View.GONE);
        callback.invoke("{\"cancel\": false}");
    }
}
